using System.Text;
using Nop.Core.Domain.Common;

namespace Nop.Plugin.Payments.RbkMoney
{
    internal static class Extensions
    {
        public static string FullName(this Address address)
        {
            return (address.FirstName + " " + address.LastName).Trim();
        }

        public static string Lines(this Address address)
        {

            string fullAddress = address.Address1;

            if (!string.IsNullOrWhiteSpace(address.Address2))
            {
                fullAddress += ", ";
                fullAddress += address.Address2;
            }


            if (fullAddress.Length > 255)
            {
                fullAddress = fullAddress.Substring(0, 252) + "...";
            }

            return fullAddress;
        }
    }
}
